
import { getCookie } from '@@/utils/index'
import { robotsapi } from './request'



export const login = async (username, password) => {
    let response = await robotsapi.post(`/login`, {
        "name": username,
        "password": password
    })

    return response.data
    // console.log(`login response=`, response)
}


export const logout = async () => {
    let response = await robotsapi.delete(`/logout`, {
        headers: {
            'X-CSRF-TOKEN': getCookie('csrf_access_token')
        }
    })
    return response
}


export const userInfo = async (source, code, state) => {
    let response = await commonapi.post(`/user_info`, {
        code,
        state,
    })
    return response.data
}


